//
//  BaiqiLayer.m
//  airplane
//
//  Created by gump gump on 5/21/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import "BaiqiLayer.h"
#import "cocos2d.h"
#import "LayerManager.h"
#import "QiPanLayer.h"

@implementation BaiqiLayer


+(CCScene *) scene
{
	// 'scene' is an autorelease object.
	CCScene *scene = [CCScene node];
	
	// 'layer' is an autorelease object.
	BaiqiLayer *layer = [BaiqiLayer node];
	
	// add layer as a child to scene
	[scene addChild: layer];
    
    QiPanLayer *layerqp = [QiPanLayer node];
    [layerqp initLayer];
    [layerqp setPosition:ccp(0,80)];
    [layerqp setContentSize:CGSizeMake(320.0f, 400.0f)];
    
    [scene addChild:layerqp];
    
    
	
	// return the scene
	return scene;
}

- (void) dealloc
{
	[super dealloc];
}

-(id) init
{
	if( (self=[super init])) {
		CCMenuItemFont *itemdanji = [CCMenuItemFont itemFromString: @"菜单" target:self selector:@selector(onDanji:)];
        //[itemdanji setPosition:ccp(260,0)];
        //[itemdanji setContentSize:CGSizeMake(60.0f, 60.0f)];
        
        CCMenuItemFont  *itemduizhan = [CCMenuItemFont itemFromString:@"帮助" target:self selector:@selector(onDuiZhan:)];
        //[itemduizhan setPosition:ccp(260,60)];
        //[itemduizhan setContentSize:CGSizeMake(60.0f, 60.0f)];
        
        CCMenu *menu = [CCMenu menuWithItems: itemdanji, itemduizhan,nil];
        [menu setPosition:ccp(260,420)];
        [menu setContentSize:CGSizeMake(60.0f, 120.0f)];
        [menu alignItemsVertically]; 
        
        [self addChild: menu];
	}
	return self;
}

-(void) onDanji: (id) sender
{
    [[LayerManager sharedLayerMag] toMenuLayer];
}

-(void) onDuiZhan: (id) sender
{
}


@end
